<?php

class AdministrationController extends Zend_Controller_Action
{

    public function init()
    {
        $this->_helper->layout()->setLayout('private');
        
    }

    public function indexAction()
    {
        $index = $this->view;
    	$index->setEscape('htmlentities');
    	$index->headLink()->appendStylesheet('../public/css/privatelayout.css');
    	$index->headScript()->appendFile('../public/js/tiny_mce/tiny_mce.js');
    	
    }

    public function blogAction()
    {
        // action body
    }

    public function hotAction()
    {
        // action body
    }

    public function myworksAction()
    {
        $myworks = $this->view;
    	$myworks->setEscape('htmlentities');
    	$myworks->headLink()->appendStylesheet('../public/css/privatelayout.css');
    	
    	
    }

    public function usersAction()
    {
        // action body
    }

    public function homeAction()
    {
        // action body
    }

    public function listAction()
    {
    	$list = $this->view;
    	$list->headLink()->appendStylesheet('../public/css/privatelayout.css');
		// get the filter form
        $listToolsForm = new Application_Form_Worksreport();
        $listToolsForm->setAction('/administration/list');
        $listToolsForm->setMethod('post');
        $this->view->listToolsForm = $listToolsForm;
        // set the sort and filter criteria. you need to update this to use the request, 
        // as these values can come in from the form post or a url parameter
        $sort = $this->_request->getParam('sort', null);
        $filterField = $this->_request->getParam('filter_field', null);
        $filterValue = $this->_request->getParam('filter');
        if (! empty($filterField)) {
            $filter[$filterField] = $filterValue;
        } else {
            $filter = null;
        }
        // now you need to manually set these controls values
        $listToolsForm->getElement('sort')->setValue($sort);
        $listToolsForm->getElement('filter_field')->setValue($filterField);
        $listToolsForm->getElement('filter')->setValue($filterValue);
        // fetch the bug paginator adapter
        $myworks = new Application_Model_DbTable_Myworks();
        $adapter = $myworks->fetchPaginatorAdapter($filter, $sort);
        $paginator = new Zend_Paginator($adapter);
        // show 10 bugs per page
        $paginator->setItemCountPerPage(10);
        // get the page number that is passed in the request. 
        //if none is set then default to page 1.
        $page = $this->_request->getParam('page', 1);
        $paginator->setCurrentPageNumber($page);
        // pass the paginator to the view to render 
        $this->view->paginator = $paginator;
        
    }

    public function photouploadedAction()
    {
        $photouploaded = $this->view;
    	$photouploaded->headLink()->appendStylesheet('../public/css/privatelayout.css');
    }


}















